const {MyLinkedList,Node}=require('./707.js')

var swapPairs = function(head) {
    let currNode = new Node(-1)
    currNode.next=head
    let p=currNode
    while(p.next){
        if(!p.next.next) break
       const node1 = p.next
       const node2 = p.next.next
       p.next=node2
       node1.next=node2.next
       node2.next=node1
       p=node1
    }
    return currNode.next
};

let List = new MyLinkedList()

List.addAtHead(1)
List.addAtHead(2)
List.addAtHead(3)
console.log(List.head);
List.head=swapPairs(List.head)
console.log(List.head);


